import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int n = sc.nextInt(); //输入一个数字
            int count = 0;  //记录连续1的个数
            int max = 0; //维护连续1的个数
            while(n != 0){
                if((n&1) == 1){
                    count++;
                    max = Math.max(max,count);
                }else{
                    count = 0;
                }
                n >>= 1;
            }
            System.out.println(max);
        }
        
    }
}
